package pl.koziolekweb.szkola.NKBeans;

// NK-Beans/Props.java
 
import java.io.*;
import java.util.*;

class Props {

    static Properties prp;

    private Props() {
        InputStream   f = null;
        try {
            f = this.getClass().getResourceAsStream(
                    "resources/kibice.properties");
            prp = new Properties();
            prp.load(f);
        } catch (Exception e) {
            System.err.println("plik resources/" +
                    "kibice.properties nie znaleziony");
            System.exit(1);
        }
        finally {
            if (f != null) {
                try {
                    f.close();
                    f = null;
                } catch (IOException ignored) { }
            }
        }
    }

    public static Properties getProps() {
        if (prp == null) new Props();
        return prp;
    }

    public static int getIntProp(String p) {
        return
            Integer.parseInt(getProps().getProperty(p));
    }

    public static double getDoubleProp(String p) {
        return
            Double.parseDouble(getProps().getProperty(p));
    }
}
